<!-- 用户资源组件 -->
<template>
	<div id="usersmanagement">
		<template>
			<el-table :data="zNodes" border style="width: 100%">
				<el-table-column prop="id" label="用户编号" width="180">
				</el-table-column>
				<el-table-column prop="usersname" label="用户名" width="180">
				</el-table-column>
				<el-table-column prop="userpwd" label="用户密码">
				</el-table-column>
				<el-table-column prop="sectionid" label="部门编号" width="180">
				</el-table-column>
				<el-table-column prop="ganweiid" label="岗位编号">
				</el-table-column>
				<el-table-column>
					<template slot="header" slot-scope="scope">
						<el-button icon="el-icon-circle-plus-outline" type="primary" plain size="mini" slot="reference"
							@click="childadd">打开添加页面</el-button>

					</template>
					<template slot-scope="scope">
						<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
						<el-button size="mini" type="danger"
							@click="handleDelete(scope.$index, scope.row)">删除</el-button>
					</template>
				</el-table-column>
			</el-table>
			<el-pagination :page-size="20" style="margin-top: 20px;" background layout="prev, pager, next" :total="1000"
				@current-change="handleCurrentChange">
			</el-pagination>
		</template>
	</div>
</template>

<script>
	export default {
		name: "usersmanagement",
		data() {
			return {
				zNodes: [{

				}],
				pageSize: "", //显示每页的条数
				total: "", //总条数
				pager: "" ,//当前页
				//绑定资源表单显示
				dialogFormVisibleAdd: false
			}
		},
		methods: {
			handleEdit(index, row) {
				console.log(index, row);
			},
			handleDelete(index, row) {
				console.log(index, row);
			},
			childadd() {
				this.$refs.refddssda.sdfghjk(true);
			},
			
			select(page){
				this.axios.get("http://localhost:8080/users/selectpage/"+ page, {
					params: {},
					headers: {
						// "token": "123"
					}
				}).then((res) => {
					// this.zNodes = res.data.datamap.chaxun;
					// console.log("111");
					// console.log(this.zNodes)
					this.total = res.data.datamap.chaxun.total; //总页数
					this.pageSize = res.data.datamap.chaxun.pageSize;
					this.pager = res.data.datamap.chaxun.pageNum;
					this.zNodes = res.data.datamap.chaxun.list;
				}).catch(err => {
					console.log(err)
				});
			},
			handleCurrentChange(val) {
				this.pager=val;
				this.select(val);
			},
			
		},
		mounted(){
			this.select(1);
		}
	}
</script>

<style scoped>
</style>